package com.lianzhihui.romeex.ui.me;

import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;

import androidx.recyclerview.widget.LinearLayoutManager;

import com.lianzhihui.romeex.MyApplication;
import com.lianzhihui.romeex.R;
import com.lianzhihui.romeex.adapter.InvitationAdapter;
import com.lianzhihui.romeex.bean.InvitationInfoBean;
import com.lianzhihui.romeex.config.AppConstants;
import com.lianzhihui.romeex.ui.base.BaseActivity;
import com.lianzhihui.romeex.utils.StatusBarUtil;
import com.lianzhihui.romeex.widget.ZFEmptyRecyclerView;

import java.util.ArrayList;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * @ProjectName: romeex
 * @Package: com.lianzhihui.romeex.ui.me
 * @ClassName: InvitationRuleActivity
 * @Description: java类作用描述
 * @Author: zhanghong
 * @CreateDate: 2020/12/11 9:45
 * @UpdateUser: 更新者：
 * @UpdateDate: 2020/12/11 9:45
 * @UpdateRemark: 更新说明：
 * @Version: 1.0
 */
public class InvitationRuleActivity extends BaseActivity {
    @BindView(R.id.myRecyclerView)
    ZFEmptyRecyclerView myRecyclerView;
    private InvitationAdapter invitationAdapter;
    @BindView(R.id.state_bar)
    View stateBar;
    @BindView(R.id.include_top_lin_background)
    LinearLayout includeTopLinBackground;
    @Override
    protected int getLayoutId() {
        return R.layout.activity_invitation_rule_layout;
    }

    @Override
    protected void initView() {
        StatusBarUtil.setStatusBarTextColor(this, false);
        LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, stateBar.getHeight());
        layoutParams.topMargin = StatusBarUtil.getStatusBarHeight(MyApplication.mContext);
        stateBar.setLayoutParams(layoutParams);
        includeTopLinBackground.setBackgroundColor(getResources().getColor(R.color.transparent));
        myRecyclerView.setLayoutManager(new LinearLayoutManager(this));
        invitationAdapter = new InvitationAdapter(new ArrayList<>());
        myRecyclerView.setAdapter(invitationAdapter);
        setTitle(getString(R.string.text_inv_rule));

        StatusBarUtil.setTransparentForImageView(this, null);

    }

    @Override
    protected void initData() {
        Bundle extras = getIntent().getExtras();
        if (extras != null) {
            InvitationInfoBean info = (InvitationInfoBean) extras.get(AppConstants.INTENT_INV_RULE);
            myRecyclerView.showEmptyView(info.getList().size(), 1);
            invitationAdapter.setNewData(info.getList());
        }
    }

    @Override
    public boolean setFitSystemWindowFlag() {
        return false;
    }

    @OnClick({R.id.include_top_iv_back})
    public void OnClick(View v) {
        switch (v.getId()) {

            case R.id.include_top_iv_back:
                finish();
                break;

            default:
                break;
        }
    }


}
